package net.entelijan.cobean.data.client;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import net.entelijan.cobean.data.literature.ILitService;
import net.entelijan.cobean.data.naming.INamingClient;

public class LookupEjb {

	private static Log log = LogFactory.getLog(LookupEjb.class);

	public LookupEjb() {
		super();
	}

	public static void main(String[] args) {
		String jndiName = "InMemLitService";
		try {
			// Profile profile = Profile.GLASSFISH_21;
			Profile profile = Profile.JBOSS_510;
			INamingClient client = profile.createNamingClient();
			ILitService litService = client.lookup(jndiName, ILitService.class);
			System.out.println("profile: '" + profile + "' book: "
					+ litService.loadBook(1));
		} catch (Exception e) {
			log.error("Could not lookup ejb '" + jndiName + "' because: "
					+ e.getMessage());
		}
	}

}
